package com.atguigu.ssyx.home.controller;
import com.atguigu.ssyx.common.auth.AuthContextHolder;
import com.atguigu.ssyx.common.result.Result;
import com.atguigu.ssyx.home.service.ItemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @作者:胡树苑
 * @时间:2025/9/21 20:30
 */
@Api(tags = "商品详情")
@RestController
@RequestMapping("/api/home")
public class ItemApiController {
    @Autowired
    private ItemService itemService;
    @ApiOperation(value = "获取sku详细信息")
    @GetMapping("/item/{id}")
    public Result index(@PathVariable("id") Long skuId) {
        Long userId = AuthContextHolder.getUserId();
       Map<String,Object> map= itemService.getItem(skuId,userId);
       return Result.ok(map);
    }
}
